import 'package:flutter/material.dart';

class SettingPage extends StatefulWidget {
  SettingPage({Key key}) : super(key: key);

  @override
  _SettingPageState createState() => _SettingPageState();
}

class _SettingPageState extends State<SettingPage> {
  final String info = "这是一串用来测试的文本信息，用于后面进行字符串拆分！";
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 4,
      child: Scaffold(
        appBar: AppBar(
          title: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Expanded(
                  flex: 1,
                  child:TabBar(
                    indicatorColor:Colors.black,
                    labelColor:Colors.black,
                    unselectedLabelColor: Colors.black26,
                    indicatorSize:TabBarIndicatorSize.tab ,

                    tabs: <Widget>[
                      Tab(text: "推荐0"),
                      Tab(text: "推荐1"),
                      Tab(text: "推荐2"),
                      Tab(text: "推荐3要长点"),
                    ],
               ) ,
              )
            ],
          ),
        ),
        body: Center(
          child: TabBarView(
            children: <Widget>[
              setTbas(1,context),
              setTbas(1,context),
              setTbas(1,context),
              setTbas(1,context)
            ],
          )
        ),
      ),
    );
  }

  Widget setTbas(int tabindex,context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text("我是一个文本"),
        Text("我是一个文本"),
        Text("我是一个文本"),
        RaisedButton(
          child: Text("跳转到登陆"),
          onPressed: () {
            Navigator.pushNamed(context, '/login');
          },
        ),
        RaisedButton(
          child: Text("跳转到注册"),
          onPressed: () {
            Navigator.pushNamed(context, '/registerFirst');
          },
        )
      ],
    );
  }
}
